package com.moly.websocketone.listener.session;

import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

/**
 * @Description:  会话监听器
 * @Author: m01
 * @Date: created at  2018/11/13  15:39
 * @Modified By:
 */
public class SessionListener implements HttpSessionListener {
    @Override
    public void sessionCreated(HttpSessionEvent se) {
        System.out.println(" -- SessionListener 会话建立了 --");
        se.getSession().setMaxInactiveInterval(1*60);//设置session过期时间
    }

    @Override
    public void sessionDestroyed(HttpSessionEvent se) {
        System.out.println(" -- SessionListener 会话断开了 --");

    }
}
